package com.basic.web.controller;

import com.basic.common.result.WebResult;
import com.basic.web.controller.req.SelectByOneForm;
import com.basic.web.dao.model.CmsWebContent;
import com.basic.web.domain.CmsWebContentBo;
import com.basic.web.service.CmsWebContentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "网页内容接口")
@RequestMapping("/webContent")
public class CmsWebContentController {
    @Autowired
    private CmsWebContentService cmsWebContentService;

    /***
     * 添加网页内容
     * @param cmsWebContent 参数
     * @return
     */
    @ApiOperation("添加网页内容")
    @PostMapping("/addCmsWebContent")
    public WebResult addCmsWebContent(@RequestBody CmsWebContent cmsWebContent){
      return   cmsWebContentService.addCmsWebContent(cmsWebContent);
    }
    @ApiOperation("根据id删除文本内容")
    @GetMapping("/deleteCmsWebContentById/{id}")
    public WebResult deleteCmsWebContentById(@PathVariable long id){
        return cmsWebContentService.deleteWebContent(id);
    }
    @ApiOperation("根据条件查询所以")
    @PostMapping("/SelectAll")
    public WebResult selectAll(@RequestBody CmsWebContent cmsWebContent){
        return WebResult.success(cmsWebContentService.selectAll(cmsWebContent));
    }
    @ApiOperation("条件查询所有进行分页")
    @PostMapping("/SelectAllPage")
    public WebResult SelectAllPage(@RequestBody CmsWebContentBo cmsWebContentBo){
        return cmsWebContentService.selectAllPage(cmsWebContentBo);
    }
    @ApiOperation("更改网页文本")
    @PostMapping("/updateCmsWebContent")
    public WebResult updateCmsWebContent(@RequestBody CmsWebContent cmsWebContent){
        return cmsWebContentService.updateWebContent(cmsWebContent);
    }
    @ApiOperation("查询单个信息")
    @PostMapping("/selectByOne")
    public WebResult selectByOne(@RequestBody SelectByOneForm selectByOneForm){
        return cmsWebContentService.SelectByOne(selectByOneForm);
    }

}
